using OnePiece.Ui.Controls.UI;
using System.IO;
using System.Web.Mvc;

namespace OnePiece.Ui.Controls
{

    /// <summary>
    /// Displays a Grid in an ASP.NET MVC view.
    /// </summary>
    public class GridSearch : jQueryViewComponentBase
    {


        /// <summary>
        /// Initializes a new instance of the <see cref="GridSearch"/> class.
        /// </summary>
        /// <param name="viewContext">The view context.</param>
        /// <param name="clientSideObjectWriterFactory">The client side object writer factory.</param>
        public GridSearch(ViewContext viewContext, IClientSideObjectWriterFactory clientSideObjectWriterFactory)
            : base(viewContext, clientSideObjectWriterFactory)
        {
            //set the grid css and js
            //this.ScriptFileNames.Add("/jqueryplugin/jquery.jqGridSearch-3.5.3/js/jquery.jqGridSearch.min.js");

            //listener for the event


            //default of properties        
            IsMultipleSearch = true;
        }



        public bool IsMultipleSearch { get; set; }





        public override void WriteInitializationScript(TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "searchGrid", writer);

            objectWriter.Start()
                        .Append("multipleSearch", IsMultipleSearch)
                        .Complete();

            base.WriteInitializationScript(writer);
        }



    }
}